<?php

header('Content-Type:text/html;charset=utf-8');

date_default_timezone_set('PRC');

class Uyweb {
	static public function Run(){
		// 框架目录
		define('UY', dirname(__FILE__).'/');
		// 引入核心文件
		self::LoadFile();
		// 创建核心文件
		self::CreateDir();
		// 运行应用
		App::Run();
	}

	static private function LoadFile(){
		$Files = require 'Files.php';
		foreach ($Files as$File) {
			is_file($File) AND require $File;
		}
	}

	static private function CreateDir(){
		if(is_dir(APP)) return ;
		$Dirs = array(
			APP,
			APP.'Index/',
			APP.'Index/Controller/',
			APP.'Index/Config/',
			APP.'Index/Model/',
			APP.'Index/View/',
			APP.'Index/View/Index/',
			APP.'Index/View/Index/Compile/',
			APP.'Index/View/Public/',
			APP.'Index/View/Public/Compile/',
		);
		foreach ($Dirs as $Dir) {
			is_dir($Dir) or mkdir($Dir,0755,true);
		}
		copy(UY.'Tpl/Controller.class.php', APP.'Index/Controller/indexController.class.php');
		copy(UY.'Config.php', APP.'Index/Config/Config.php');
		copy(UY.'Tpl/index.html', APP.'Index/View/Index/index.html');
		copy(UY.'Tpl/success.html', APP.'Index/View/Public/success.html');
		copy(UY.'Tpl/error.html', APP.'Index/View/Public/error.html');
	}
}

Uyweb::Run();


?>